﻿@using KPIS.GERP.Models
@using KPIS.GERP.Models.SYS.ViewModel
@using KPIS.GERP.WEB.GAMS.Class
@using KPIS.GERP.Models.Class

@model IEnumerable<MenuItem>

@* @Html.SiteNavigate(MenuHelper.MenuItems) *@
@{
	var routeControllerName = Html.ControllerName();
	var routeActionName = Html.ActionName();

	List<MenuItem> oneLevelMenuItems = Model.ToList();
	foreach(var m in Model)
	{
		if(m.MenuItems != null && m.MenuItems.Count > 0)
		{
			oneLevelMenuItems.AddRange(m.MenuItems);
		}
	}
     
	var menuText = routeControllerName.ToLower() == "home" ? 
        null : 
        (from m in oneLevelMenuItems 
         where CompareUtility.IsStringsEqual(Html.GetControllerName(m.NavigateUrl), routeControllerName) && 
         !CompareUtility.IsStringsEqual(Html.GetActionName(m.NavigateUrl), routeActionName) 
         select m.Text).FirstOrDefault();
}
 
<ul class="breadcrumb">
	<li> 
		<i class="icon-home"></i>
		<strong>@Html.ActionLink("หน้าหลัก", "Index", "Home" )</strong>
		<span class="divider">
			<i class="icon-angle-right"></i>
		</span>
	</li>
					 
	@if (!string.IsNullOrWhiteSpace(menuText))
	{
		<li>
			@Html.ActionLink(menuText, "Index", routeControllerName)
			<span class="divider">
				<i class="icon-angle-right"></i>
			</span>
		</li>
	}
	<li class="active">@(ViewBag.TitleNav??ViewBag.Title)</li>
</ul><!--.breadcrumb-->